package com.liuya.db.orm;

import com.liuya.common.exception.EntityExistException;

import java.sql.Connection;

/**
 * Update entity operations to database.
 * 
 * @author back
 *
 */
public interface TableUpdator {
	/**
	 * Table definition.
	 * 
	 * @param mapping
	 */
	public void setTable(Table mapping);

	/**
	 * Update an entity. If it doesn't exist, throw no exception; If update
	 * operation would violate some constraints, throw EntityExistException
	 * 
	 * @param newValue
	 * @throws EntityExistException
	 */
	public void updateByIdColumns(Object newValue) throws EntityExistException;

	public void updateByIdColumns(Connection conn, Object newValue) throws EntityExistException;
}
